<template>
  <div>
    <div class="JUMP">
      <el-row :gutter="20" class="JUMP-titile">
        <el-col :span="8"
          ><div class="grid-content bg-purple">
            <el-button type="primary" round @click="showtitle = 1">我的信息</el-button>
          </div></el-col
        >
        <el-col :span="8"
          ><div class="grid-content bg-purple">
            <el-button type="primary" round @click="showtitle = 3">请假审批</el-button>
          </div></el-col
        >
      </el-row>
    </div>
    <PersonalMessage :personalmessagedata="personaldata" v-if="showtitle == 1"></PersonalMessage>
    <Record :leaverecord="LeaveRecord" v-if="showtitle == 2"></Record>
    <Leave v-if="showtitle == 3"></Leave>
  </div>
</template>
<script>
import api from '@/api/api'
import PersonalMessage from './PersonalMessage/index.vue'
import Record from './record/record.vue'
import Leave from './Leave/Leave.vue'
export default {
  data() {
    return {
      showtitle: 1,
      personaldata: { roleInfoDTOS: [{ roleName: '' }] },
      LeaveRecord: {},
      recordData: [],
      pages: 0,
    }
  },
  components: {
    PersonalMessage,
    Record,
    Leave,
  },
  methods: {
    getusermessage() {
      api.getpersonal().then(res => {
        if (res.code == 200) {
          this.personaldata = res.data
        } else {
          this.$message({
            message: '网络错误！请刷新重试',
            type: 'error',
          })
        }
      })
    },
    getrecord() {
      api.record().then(res => {
        if (res.code == 200) {
          this.LeaveRecord = res.data
        } else {
          this.$message({
            message: '网络错误！请刷新重试',
            type: 'error',
          })
        }
      })
    },
  },
  created() {
    this.getusermessage()
    this.getrecord()
  },
}
</script>

<style lang="scss" scoped>
@import './Approval.scss';
</style>
